package com.example.service.impl;

import com.example.dao.IAcountDao;
import com.example.service.IAcountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

@Service("accountService")
public class AcountServiceImpl implements IAcountService {
//    @Autowired
//    @Qualifier("acountDao1")
    @Resource(name = "acountDao1")
    private IAcountDao acountDao;//注意这个value不要写错了，写错了就没救了

    @PostConstruct
    public void init() {
        System.out.println("完成初始化方法");
    }
    @PreDestroy
    public void destory() {
        System.out.println("完成销毁方法");
    }
    public void account() {
        acountDao.saveAccount();
        System.out.println("完成执行account方法");
    }
}
